home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-06-28 | 751 b | 46 lines | [TEXT/CWIE] |
- // CommandLink.h
-
- #ifndef CommandLink_h
- #define CommandLink_h
-
- #ifndef Activator_h
- #include "Activator.h"
- #endif
-
- template < class Protocol >
- class CommandLink: public Activator
- {
- private:
- Protocol& handler;
-
- static Protocol *activeHandler;
-
- public:
- CommandLink( Focus& focus, Protocol& theHandler )
- : Activator( focus ),
- handler( theHandler )
- {}
-
- virtual void Activate()
- {
- Assert( activeHandler == 0 );
- activeHandler = &handler;
- }
-
- virtual void Deactivate()
- {
- Assert( activeHandler == &handler );
- activeHandler = 0;
- }
-
- static Protocol *ActiveHandler()
- {
- return activeHandler;
- }
- };
-
- template < class Protocol >
- Protocol *CommandLink< Protocol >::activeHandler = 0;
-
- #endif
-